<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c"
           uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head> 
  <meta content="542536566763012535145636" property="qc:admins" /> 
  <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> 
  <title>每日一笑</title> 
  <meta content="各种口味,每日一笑,笑话精选,很搞笑的笑话,非常搞笑的笑话" name="keywords" /> 
  <meta content="享笑网提供各种口味的笑话,其中包括：图片笑话,搞笑图片,少儿不宜,校园趣闻,超级内涵,搞笑内涵,贴近生活等笑话种类，本栏目笑话主要是各种口味,享笑网祝大家生活笑口常开，开心每一天!" name="description" /> 
  <meta content="width=1050" name="viewport" />
  <!-- Bootstrap -->
  <link href="/css/bootstrap.min.css" rel="stylesheet">
  <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
  <script src="/js/jquery.min.js"></script>
  <!-- Include all compiled plugins (below), or include individual files as needed -->
  <script src="/js/bootstrap.min.js"></script>
  <link href="/css/common.css?v7.2" type="text/css" rel="stylesheet" />
  <link href="/css/public.css?v1" type="text/css" rel="stylesheet" />
  <link rel="stylesheet" href="/css/style.css" type="text/css">
  <link rel="stylesheet" href="/css/comment.css" type="text/css">
  <link type="/image/x-icon" rel="icon" mce_href="images/favicon.ico" href="images/favicon.ico?v=0.1" />
  <link type="/image/x-icon" rel="shortcut icon" mce_href="images/favicon.ico" href="images/favicon.ico?v=0.1" />
  <script src="/js/hm.js?ed37722b76c3b14891aee449d10db2b1"></script>
  <script src="/js/jq.js?v4.1" type="text/javascript"></script>
  <script src="/js/ss.js?v4.8" type="text/javascript"></script>
  <script src="/js/dateForm.js" type="text/javascript"></script>
  <script type="text/javascript" src="/js/jquery.flexText.js"></script>
  <script type="text/javascript">

function getBrowser()
{  
   var OsObject = "";  
   if(navigator.userAgent.indexOf("MSIE")>0) {  
		var browser=navigator.appName;
		var b_version=navigator.appVersion; 
		var version=b_version.split(";"); 
		var trim_Version=version[1].replace(/[ ]/g,""); 
		if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE6.0") 
		{ 
			return("IE6"); 
		} 
		else if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE7.0") 
		{ 
			return("IE7"); 
		} 
		else if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE8.0") 
		{ 
			return("IE8"); 
		} 
		else if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE9.0") 
		{ 
			return("IE9"); 
		}
		else if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE10.0") 
		{ 
			return("IE10"); 
		}
   }  
   if( navigator.userAgent.indexOf("Firefox")>0){  
        return "Firefox";  
   }
   if( navigator.userAgent.indexOf("Chrome")>0){  
        return "Chrome";  
   }
   if( navigator.userAgent.indexOf("Opera")>0){  
        return "Opera";  
   } 
   if( navigator.userAgent.indexOf("Safari")>0) {  
        return "Safari";  
   }
   return 'Others';  
} 
(function(){
	vars = {};
	vars.browser = getBrowser();
	vars.hello_ketty = "heimao";
	vars.jsUrl = "http://www.sharesmile.cn/js/";
	vars.homeUrl = 'http://www.sharesmile.cn/';
	vars.siteName = '享笑网 - www.ShareSmile.cn - 享你所想,享你所笑';
	vars.publicUrl = "/public/";
	vars.showgirlUrl = "/user#showgirl";
	vars.userid = '10460';
	vars.username = '515944701@qq.com';
	vars.nickname = 'nidaye';
	vars.gender = 0;
	vars.PHPSESSID = "krach1sltrpu5pa9ldu9jen4k2";
	vars.ajaxSubmiting = false;
	vars.sysImageUrl = '/public/system/';
	vars.qingImageUrl = '/public/qing/';
	vars.headImageUrl = '/public/userhead/';
	vars.postImageUrl = '/public/post/';
	vars.essayImageUrl = '/public/essay/';
	vars.jokesImageUrl = '/public/jokes/';
	vars.showgirlImageUrl = '/public/showgirl/';
	vars.photoImageUrl = '/public/photo/';
	vars.commStatUrl = '/Stat/stat';
	vars.cookieUMessage = 'HASMESSAGE'+vars.userid;
	vars.voteBlankColor = new Array( '#5DBBEF', '#95E62A', '#CC1CD9', '#FFCD10', '#F79395');
	vars.todayTimeString = 20160122;
})();
</script>
  <script src="/js/share.js?v=89860593.js?cdnversion=403739"></script>
  <link rel="stylesheet" href="/css/share_style0_16.css?v=6aba13f0.css" />

  <style>
   .box{
    width:80%; margin-top:10%; margin:auto; padding:28px;
    height:100px; border:1px #111 solid;
    display:none;            /* 默认对话框隐藏 */
   }
   .box.show{display:block;}
   .box .x{ font-size:8px; width: 10%; text-align:right;  display:block; margin-left: 400px; margin-top: -32px;}
   .box input{width:90%; font-size:18px; margin-top:18px;}


   .black_overlay{
    display: none;
    position: absolute;
    top: 0%;
    left: 0%;
    width: 100%;
    height: 100%;
    background-color: black;
    z-index:1001;
    -moz-opacity: 0.8;
    opacity:.80;
    filter: alpha(opacity=88);
   }
   .white_content {
    display: none;
    position: absolute;
    top: 25%;
    left: 25%;
    width: 45%;
    height: 35%;
    padding: 20px;
    border: 10px solid orange;
    background-color: white;
    z-index:1002;
    overflow: auto;
   }
   .myTit {
    width:600px;
    line-height: 20px;
    font-size: 14px;
    background: lightblue;
    color:#333;
    padding:20px;
   }
  </style>
 </head> 
 <body>
  <div style="position: absolute; left: -9999em; top: 175px; width: auto; z-index: 1987;" class="aui_state_focus">
   <div class="aui_outer">
    <table class="aui_border">
     <tbody>
      <tr>
       <td class="aui_nw"></td>
       <td class="aui_n"></td>
       <td class="aui_ne"></td>
      </tr>
      <tr>
       <td class="aui_w"></td>
       <td class="aui_c">
        <div class="aui_inner">
         <table class="aui_dialog">
          <tbody>
           <tr>
            <td class="aui_header" colspan="2">
             <div class="aui_titleBar">
              <div class="aui_title" style="cursor: move;">
               消息
              </div>
              <a class="aui_close">&times;</a>
             </div></td>
           </tr>
           <tr>
            <td class="aui_icon" style="display: none;">
             <div class="aui_iconBg" style="background: transparent none repeat scroll 0% 0%;"></div></td>
            <td class="aui_main" style="width: auto; height: auto;">
             <div class="aui_content" style="padding: 20px 25px;">
              <div class="aui_loading">
               <span>loading..</span>
              </div>
             </div></td>
           </tr>
           <tr>
            <td class="aui_footer" colspan="2">
             <div class="aui_buttons" style="display: none;"></div></td>
           </tr>
          </tbody>
         </table>
        </div></td>
       <td class="aui_e"></td>
      </tr>
      <tr>
       <td class="aui_sw"></td>
       <td class="aui_s"></td>
       <td class="aui_se" style="cursor: se-resize;"></td>
      </tr>
     </tbody>
    </table>
   </div>
  </div> 
  <div class="pb-container"> 
   <div class="pb-container-main pb-after-clear"> 
    <!-- 公共头部 --> 
    <div class="pb-main pb-navwrap pb-after-clear"> 
     <div class="pb-iblock pb-fl pb-logo"> 
      <a href="index.jsp"><img alt="享笑网LOGO 征文比赛 有奖征文" src="/images/logo.jpg" /></a>
     </div> 
     <div class="pb-iblock pb-fl pb-nav"> 
      <ul> 
            <li><a href="/index">首页</a></li> 
			<li><a href="/news">征文比赛</a></li> 
             <li><a href="/world/pic">倾听世界</a></li> 
            <li><a href="/earlist">叫醒耳朵</a></li>  
           <li class="pb-nav-li-last"><a href="/joke/select.do">每日一笑</a></li> 
       </ul> 
     </div> 
     <div class="pb-iblock pb-fr pb-oths"> 
      <a onclick="Sys.commStat(2);commonLib.SetHome(this);" href="javascript:void(0);" class="nmt">设为首页</a> 
      <a onclick="Sys.commStat(1);commonLib.addFavorite();" rel="sidebar" href="index.jsp" class="nmt">收藏我们</a> 
                   <span class="nmt"> | </span> 
                        <div class="pb-ucenter pb-after-clear" id="islogin"> 
                            <div id="uMessageCenter"> 
                                <i class="pb-icons triangle"></i> 
                                <a href="/user" id="uSetEntry-head"><img src="${sessionScope.user.uimg }" alt="阿斗" /></a> 
                                <i class="pb-icons notice pb-hide"></i> 
                            </div> 
                            <br /> 
                            <ul> 
                                <li><a href="/user/userinfo" id="uSetEntry"><i class="pb-icons my"></i> 个人中心</a></li> 
                                <li><a href="/user/logout"><i class="pb-icons logout"></i> 退出登录</a></li> 
                            </ul> 
                        </div>
                        <div id="nologin">
                        	<div class="pb-iblock" style="margin-top:12px ;">
							<a href="/user/login" id="uSetEntry"><i class="pb-icons my"></i> 登录</a>
                            <a href="/user/reg"><i class="pb-icons logout"></i> 注册</a>
							</div>
                        	
                        </div>
                        
                        <br /> 
                        
                <script type="text/javascript">
                	$(function(){
                		var user='${sessionScope.user}';
                		if(user==''){
                			console.log("请登录");
                			$("#nologin").show();
                			$("#islogin").hide();
                		}else{
                			console.log(user);
                			$("#nologin").hide();
                			$("#islogin").show();
                		}
                	});
                	
                </script>
      <form onsubmit="W.tips('暂未开放搜索功能，敬请期待!');Sys.commStat(6);return false;" action=""> 
       <input type="submit" value="" class="pb-search-btn" /> 
       <input type="text" class="pb-search" /> 
      </form> 
     </div> 
    </div>

    <!-- 公共头部 -->
    <!-- 面包屑 -->
    <div class="pb-main pb-breadcrumbs pb-mt40 pb-size-small">
     <a href="index.jsp">首页</a> &gt;&gt;
     <a href="laugh.jsp">每日一笑</a> &gt;&gt;
     <a>各种口味</a>
    </div>
    <!-- 面包屑结束 -->
    <input type="hidden" name="verifyCode" id="verifyCode" value="" />
    <!--content-->
    <div class="pb-main pb-mt20">
     <div class="commmain">
      <div class="nav">
       <a class="active" href=${pageContext.request.contextPath}/joke/select.do>各种口味</a>
       <span>|</span>
       <a href=${pageContext.request.contextPath}/joke/select.do?jcategory=1>少儿不宜</a>
       <span>|</span>
       <a href=${pageContext.request.contextPath}/joke/select.do?jcategory=2>校园趣闻</a>
       <span>|</span>
       <a href=${pageContext.request.contextPath}/joke/select.do?jcategory=3>超级内涵</a>
       <span>|</span>
       <a href=${pageContext.request.contextPath}/joke/select.do?jcategory=4>贴近生活</a>
       <span>|</span>
       <a href=${pageContext.request.contextPath}/joke/select.do?jcategory=5>图片笑话</a>
      </div>
      <c:forEach items="${res.list}" var="jokeVo">
      <div class="one-joke w-bg pb-mt20 pb-after-clear">
       <img alt="叫醒闹钟" src="${jokeVo.uimg}" class="${jokeVo.jcategory}" />
       <div id="w-joke-${jokeVo.jid}" jid="${jokeVo.jid}" class="con f-r">
        <p class="myTit"> ${jokeVo.jdesc} </p><a id="a${jokeVo.jid}" href="javascript:void(0);" onclick = "document.getElementById('light${jokeVo.jid}').style.display='block';document.getElementById('fade${jokeVo.jid}').style.display='block'">详细&raquo;</a>
        <%--
         *  弹窗
        --%>
        <div id="light${jokeVo.jid}" class="white_content">详细信息
         <a href = "javascript:void(0)" onclick = "document.getElementById('light${jokeVo.jid}').style.display='none';document.getElementById('fade${jokeVo.jid}').style.display='none'" style="margin-left: 600px">点这里关闭本窗口</a>
         <br><br><br><br><br>
         <a>作者:${jokeVo.jauthor}</a>
         <img src="${jokeVo.jimg}" alt="作者头像">
         <p>创建时间: ${jokeVo.jcreatetime}</p>
         <c:if test="${jokeVo.jcategory == 1}">
         <p>文章类别:少儿不宜</p>
         </c:if>
         <c:if test="${jokeVo.jcategory == 2}">
          <p>文章类别:校园趣闻</p>
         </c:if>
         <c:if test="${jokeVo.jcategory == 3}">
          <p>文章类别:超级内涵</p>
         </c:if>
         <c:if test="${jokeVo.jcategory == 4}">
          <p>文章类别:贴近生活</p>
         </c:if>
         <c:if test="${jokeVo.jcategory == 5}">
          <p>文章类别:图片笑话</p>
         </c:if>

          <a>内容:${jokeVo.jdesc}</a><br>

          <a href = "javascript:void(0)" id="loading${jokeVo.jid}" onclick="showAllComments${jokeVo.jid}()">点击加载当前所有评论...</a>


         <script type="text/javascript">

          function showAllComments${jokeVo.jid}() {
              var tarticleid = "${jokeVo.jid}";
              //var ttopicid = uid;
              var talk = JSON.stringify(
                  {"tcategory": "4", "tarticleid": tarticleid});
              var isAll = eval("false");
              $.ajax({
                  type: "POST",
                  url: "${pageContext.request.contextPath}/Talk/searchcomment.do",
                  data: {"talk":talk,"isAll":isAll},
                  dataType:"json",
                  async : true,
                  //contentType: 'application/json;charset=utf-8',
                  success: function(value){
                      console.log(value);
                      if(value.status==0){

                          //先清除之前的标签
                          $("#show2 div").remove();

                          var str = "";
                          var res = value.data.childrens;
                          console.log(res);
                          for(var i in res){
                              if (!isNaN(i)){
                              console.log(i);
                              var uid = res[i].uid;
                              var uimg = res[i].uimg;
                              var temp = new Date(res[i].tcreatetime);
                              var tcreatetime = dateFtt("yyyy-MM-dd hh:mm:ss",temp);
                              str += '<div id = "show2"  class="comment-show-con clearfix"><div class="comment-show-con-img pull-left"><img src='+uimg+' alt="用户头像"></div> <div class="comment-show-con-list pull-left clearfix"><div class="pl-text clearfix"> <a href="#" class="comment-size-name">'+res[i].uname+' </a> : <span class="my-pl-con">&nbsp;'+ res[i].ttalkinfo +'</span> </div> <div class="date-dz"> <span class="date-dz-left pull-left comment-time" id = "tid" talkid = '+res[i].tid+' uid = '+uid+'>'+tcreatetime+'</span><a href="javascript:void(0);" onclick="showCurrentComments('+res[i].tid+',${jokeVo.jid})">"查看当前回复"</a> <div class="date-dz-right pull-right comment-pl-block"><a href="javascript:;" class="removeBlock">删除</a> <a href="javascript:;" class="date-dz-pl pl-hf${jokeVo.jid} hf-con-block pull-left">回复</a> <span class="pull-left date-dz-line">|</span> <a href="javascript:;" class="date-dz-z pull-left"><i class="date-dz-z-click-red"></i>赞 (<i class="z-num">0</i>)</a> </div> </div><div class="hf-list-con"></div></div> </div></br>';
                              }
                          }
                          $("#s${jokeVo.jid}").prepend(str);
                      }
                  },
                  error: function() {
                      alert("查询失败");
                  }
              });
          }


         </script>


         <!--
    此评论textarea文本框部分使用的https://github.com/alexdunphy/flexText此插件
-->
         <div class="commentAll" >
          <!--评论区域 begin-->
          <div class="reviewArea clearfix">
           <textarea class="content comment-input" placeholder="Please enter a comment&hellip;" onkeyup="keyUP(this)"></textarea>
           <a href="javascript:;" class="plBtn${jokeVo.jid}">评论</a>
          </div>
          <!--评论区域 end-->
          <!--回复区域 begin-->
          <div class="comment-show" id="s${jokeVo.jid}" >

          </div>
          <!--回复区域 end-->
         </div>


         <!--textarea高度自适应-->
         <script type="text/javascript">
             $(function () {
                 $('.content').flexText();
             });
         </script>
         <!--textarea限制字数-->
         <script type="text/javascript">
             function keyUP(t){
                 var len = $(t).val().length;
                 if(len > 139){
                     $(t).val($(t).val().substring(0,140));
                 }
             }
         </script>
         <!--点击评论创建评论条-->
         <script type="text/javascript">
             $('.commentAll').on('click','.plBtn${jokeVo.jid}',function(){
                 var myDate = new Date();
                 //获取当前年
                 var year=myDate.getFullYear();
                 //获取当前月
                 var month=myDate.getMonth()+1;
                 //获取当前日
                 var date=myDate.getDate();
                 var h=myDate.getHours();       //获取当前小时数(0-23)
                 var m=myDate.getMinutes();     //获取当前分钟数(0-59)
                 if(m<10) m = '0' + m;
                 var s=myDate.getSeconds();
                 if(s<10) s = '0' + s;
                 var now=year+'-'+month+"-"+date+" "+h+':'+m+":"+s;
                 //获取输入内容
                 var oSize = $(this).siblings('.flex-text-wrap').find('.comment-input').val();
                 console.log(oSize);
                 //动态创建评论模块
                 //TODO uid = ${user.uid}

                 var fathertime = null;
                 var tarticleid = "${jokeVo.jid}";
                 var tcontent = oSize;
                 var ttopicid = 0;
                 var talk = JSON.stringify(
                     {"tcategory": "4", "tarticleid": tarticleid,"tcontent": tcontent,"fathertime":fathertime,"ttopicid":ttopicid});
                 $.ajax({
                     type: "POST",
                     url: "${pageContext.request.contextPath}/Talk/addcomment.do",
                     data: talk,
                     dataType:"json",
                     async : true,
                     contentType: 'application/json;charset=utf-8',
                     success: function(value){
                         var uid = value.data.uid;
                         var jid = ${jokeVo.jid};
                         alert(uid+":"+jid);
                         oHtml = '<div id = '+uid+'  class="comment-show-con clearfix"><div class="comment-show-con-img pull-left"><img src="${jokeVo.jimg}" alt="用户头像"></div> <div class="comment-show-con-list pull-left clearfix"><div class="pl-text clearfix"> <a href="#" class="comment-size-name">'+value.data.uname+' </a> : <span class="my-pl-con">&nbsp;'+ oSize +'</span> </div> <div class="date-dz"> <span class="date-dz-left pull-left comment-time" id = "tid" talkid = '+value.data.tid+' uid = '+uid+'>'+now+'</span><a href="javascript:void(0);" onclick="showCurrentComments('+value.data.tid+',${jokeVo.jid})">"查看当前回复"</a> <div class="date-dz-right pull-right comment-pl-block"><a href="javascript:;" class="removeBlock">删除</a> <a href="javascript:;" class="date-dz-pl pl-hf${jokeVo.jid} hf-con-block pull-left">回复</a> <span class="pull-left date-dz-line">|</span> <a href="javascript:;" class="date-dz-z pull-left"><i class="date-dz-z-click-red"></i>赞 (<i class="z-num">666</i>)</a> </div> </div><div class="hf-list-con"></div></div> </div>';
                             $("#s${jokeVo.jid}").prepend(oHtml);
                     },
                     error: function() {
                     }
                 });



             });
         </script>
         <!--点击回复动态创建回复块-->
         <script type="text/javascript">
             $('.comment-show').on('click','.pl-hf${jokeVo.jid}',function(){
                 //获取回复人的名字
                 var fhName = $(this).parents('.date-dz-right').parents('.date-dz').siblings('.pl-text').find('.comment-size-name').html();
                 //回复@
                 var fhN = '回复@'+fhName;
                 //var oInput = $(this).parents('.date-dz-right').parents('.date-dz').siblings('.hf-con');
                 var fhHtml = '<div class="hf-con pull-left"> <textarea class="content comment-input hf-input" placeholder="" onkeyup="keyUP(this)"></textarea> <a href="javascript:;" class="hf-pl${jokeVo.jid}">评论</a></div>';
                 //显示回复
                 if($(this).is('.hf-con-block')){
                     $(this).parents('.date-dz-right').parents('.date-dz').append(fhHtml);
                     $(this).removeClass('hf-con-block');
                     $('.content').flexText();
                     $(this).parents('.date-dz-right').siblings('.hf-con').find('.pre').css('padding','6px 15px');
                     //console.log($(this).parents('.date-dz-right').siblings('.hf-con').find('.pre'))
                     //input框自动聚焦
                     $(this).parents('.date-dz-right').siblings('.hf-con').find('.hf-input').val('').focus().val(fhN);
                 }else {
                     $(this).addClass('hf-con-block');
                     $(this).parents('.date-dz-right').siblings('.hf-con').remove();
                 }
             });
         </script>
         <!--评论回复块创建-->
         <script type="text/javascript">
             $('.comment-show').on('click','.hf-pl${jokeVo.jid}',function(){
                 var oThis = $(this);
                 var myDate = new Date();
                 //获取当前年
                 var year=myDate.getFullYear();
                 //获取当前月
                 var month=myDate.getMonth()+1;
                 //获取当前日
                 var date=myDate.getDate();
                 var h=myDate.getHours();       //获取当前小时数(0-23)
                 var m=myDate.getMinutes();     //获取当前分钟数(0-59)
                 if(m<10) m = '0' + m;
                 var s=myDate.getSeconds();
                 if(s<10) s = '0' + s;
                 var now=year+'-'+month+"-"+date+" "+h+':'+m+":"+s;

                 var time = $(this).parent().parent().parent().find("#tid").text();

                 var fathertime = getDate(time);

                 var uid = $(this).parent().parent().parent().find("#tid").attr("uid");

                 console.log(fathertime+":"+uid);
                 //获取输入内容
                 var oHfVal = $(this).siblings('.flex-text-wrap').find('.hf-input').val();
                 /*var index = oHfVal.indexOf(" ",0);
                 var comment = oHfVal.substr(index).trim();*/
                 var oHfName = $(this).parents('.hf-con').parents('.date-dz').siblings('.pl-text').find('.comment-size-name').html();
                 var oAllVal = '回复@'+oHfName;
                 if(oHfVal.replace(/^ +| +$/g,'') == '' || oHfVal == oAllVal){
                     alert("请填写评论！");
                 }else {
                     //去后台插入数据 并返回数据给前台

                     var tarticleid = "${jokeVo.jid}";
                     var tcontent = oHfVal;
                     var ttopicid = uid;
                     var talk = JSON.stringify(
                         {"tcategory": "4", "tarticleid": tarticleid,"tcontent": tcontent,"fathertime":fathertime,"ttopicid":ttopicid});
                     $.ajax({
                         type: "POST",
                         url: "${pageContext.request.contextPath}/Talk/addcomment.do",
                         data: talk,
                         dataType:"json",
                         async : true,
                         contentType: 'application/json;charset=utf-8',
                         success: function(value){
                             var uid = value.data.uid;
                             var uimg = value.data.uimg;
                             var oHtml = '<div id = '+uid+'  class="comment-show-con clearfix"><div class="comment-show-con-img pull-left"><img src='+uimg+' alt="用户头像"></div> <div class="comment-show-con-list pull-left clearfix"><div class="pl-text clearfix"> <a href="#" class="comment-size-name">'+value.data.uname+' </a> : <span class="my-pl-con">&nbsp;'+ value.data.ttalkinfo +'</span> </div> <div class="date-dz"> <span class="date-dz-left pull-left comment-time" id = "tid" talkid = '+value.data.tid+' uid = '+uid+'>'+now+'</span><a href="javascript:void(0);" onclick="showCurrentComments('+value.data.tid+',${jokeVo.jid})">"查看当前回复"</a> <div class="date-dz-right pull-right comment-pl-block"><a href="javascript:;" class="removeBlock">删除</a> <a href="javascript:;" class="date-dz-pl pl-hf${jokeVo.jid} hf-con-block pull-left">回复</a> <span class="pull-left date-dz-line">|</span> <a href="javascript:;" class="date-dz-z pull-left"><i class="date-dz-z-click-red"></i>赞 (<i class="z-num">0</i>)</a> </div> </div><div class="hf-list-con"></div></div> </div>';
                             $("#s${jokeVo.jid}").prepend(oHtml);
                         },
                         error: function() {

                         }
                     });
                 }
             });



         </script>
         <script type="text/javascript">
             function getDate(strDate){
                 var date = eval('new Date(' + strDate.replace(/\d+(?=-[^-]+$)/,
                         function (a) { return parseInt(a, 10) - 1; }).match(/\d+/g) + ')');
                 return date;
             }
         </script>




         <!--点赞-->
         <script type="text/javascript">
             $('.comment-show').on('click','.date-dz-z',function(){
                 var zNum = $(this).find('.z-num').html();
                 if($(this).is('.date-dz-z-click')){
                     zNum--;
                     $(this).removeClass('date-dz-z-click red');
                     $(this).find('.z-num').html(zNum);
                     $(this).find('.date-dz-z-click-red').removeClass('red');
                 }else {
                     zNum++;
                     $(this).addClass('date-dz-z-click');
                     $(this).find('.z-num').html(zNum);
                     $(this).find('.date-dz-z-click-red').addClass('red');
                 }
             })
         </script>

        </div>
        <div id="fade${jokeVo.jid}" class="black_overlay"></div>
        <%--截取字符串 只显示部分...--%>
        <script type="text/javascript">
            $(".myTit").each(function(){
                var len=$(this).text().length;   //当前HTML对象text的长度
                if(len>30){
                    var str="";
                    str=$(this).text().substring(0,30)+"......";  //使用字符串截取，获取前30个字符，多余的字符使用“......”代替
                    $(this).html(str);                   //将替换的值赋值给当前对象
                }
            });
        </script>


        <p class="but"> <a class="bad grey" val="bad" onclick="changeAttitude${jokeVo.jid}(${jokeVo.jid},0)" href="javascript:void(0);"><i></i><span id="unlike${jokeVo.jid}">${jokeVo.junlike}</span></a> <a class="perfect grey" val="perfect" onclick="changeAttitude${jokeVo.jid}(${jokeVo.jid},1)" href="javascript:void(0);"><i></i><span id="like${jokeVo.jid}">${jokeVo.jlike}</span></a> <a class="commt" href="javascript:void(0);"><i></i><span id="comments${jokeVo.jid}">${jokeVo.comments}</span></a> <span style="clear:both;display:block;"></span> </p>

        <%--显示like 与 unlike 的数目--%>
        <script type="text/javascript">
            function changeAttitude${jokeVo.jid}(jid,attitude){
                $.get("${pageContext.request.contextPath}/joke/attitude",{"jid":jid,"attitude":attitude},function (res) {
                    if(res.status == 0){
                            $("#unlike${jokeVo.jid}").text(res.data.junlike+"");
                            $("#like${jokeVo.jid}").text(res.data.jlike+"");
                    }
                });
            }
        </script>

        <div style="line-height: 26px; margin: 10px 0px;">
         <span class="pb-fl">分享给好友：</span>
         <div pkid="${jokeVo.jid}" class="bdsharebuttonbox bdshare-button-style0-16" data-bd-bind="1453465381909">
          <a data-cmd="qzone" class="bds_qzone" href="https://qzone.qq.com/" title="分享到QQ空间"></a>
          <a data-cmd="tsina" class="bds_tsina" href="https://passport.weibo.com/" title="分享到新浪微博"></a>
          <a data-cmd="renren" class="bds_renren" href="http://www.renren.com/" title="分享到人人网"></a>
          <a data-cmd="weixin" class="bds_weixin" href="https://wx.qq.com/.com/" title="分享到微信"></a>
         </div>
         <script>
             window._bd_share_config_${jokeVo.jid}={common:{
                             bdText:"${jokeVo.jdesc}",
                             bdPic:"${jokeVo.uimg}",
                           },share:{"bdSize" : 16}};
             with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];
         </script>
        </div> 
        <div class="d-n cmtl"> 
         <ul jid="${jokeVo.jid}">
         </ul> 
         <div class="oth"> 
          <a class="more" href="javascript:void(0);">点击查看更多&gt;&gt;</a> 
          <a class="shou" href="javascript:void(0);">收起评论&gt;&gt;</a>
         </div> 
        </div>
        <input type="button" onClick="msgbox${jokeVo.jid}(1)" value="回复">
        <script>
            function msgbox${jokeVo.jid}(n){
                document.getElementById('div${jokeVo.jid}').style.display=n?'block':'none';     /* 点击按钮打开/关闭 对话框 */
            }
        </script>
        <div id='div${jokeVo.jid}' class="box">
         <a class='x' href=''; onclick="msgbox${jokeVo.jid}(0); return false;">关闭</a>
         <input type="text" id="comments-${jokeVo.jid}">
         <input type="button" id = "inp-${jokeVo.jid}" value="提交评论" onclick="submitComm${jokeVo.jid}()">
        </div>


        <div id="show${jokeVo.jid}"></div>

        <script type="text/javascript">
            /**
             * 添加评论
             * @param url
             * @param fathertime
             * @param tarticleid 为 jid
             * @param tcontent 评论内容
             * @param fathertime 被回复人的时间
             */
            /*$('#submitCom').click(*/
            function submitComm${jokeVo.jid} (){
                var comments = $("#comments-${jokeVo.jid}").val();
                var fathertime = null;
                var tarticleid = "${jokeVo.jid}";
                var tcontent = comments;
                var ttopicid = 0;
                var talk = JSON.stringify(
                {"tcategory": "4", "tarticleid": tarticleid,"tcontent": tcontent,"fathertime":fathertime,"ttopicid":ttopicid});
                $.ajax({
                    type: "POST",
                    url: "${pageContext.request.contextPath}/Talk/addcomment.do",
                    data: talk,
                    dataType:"json",
                    async : true,
                    contentType: 'application/json;charset=utf-8',
                    success: function(value){
                        var temp = new Date(value.data.tcreatetime);
                        var tcreatetime = dateFtt("yyyy-MM-dd hh:mm:ss",temp);
                        //alert("成功啦！"+"回复时间为："+tcreatetime+"..."+"用户头像为"+value.data.uimg+" 用户名:"+value.data.uname+"回复信息:"+value.data.ttalkinfo);
                        var nums = $("#comments${jokeVo.jid}").text();
                        var num= parseInt(nums);
                        var temp = 1;
                        var res = num+temp;
                        $("#comments${jokeVo.jid}").html(res);
                        $("#show${jokeVo.jid}").html("<img alt=\"用户头像\" class=\"pb-block\" src= \""+value.data.uimg+"\" /><a>"+value.data.uname+"&nbsp&nbsp&nbsp&nbsp"+tcreatetime+"</a>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</br><p>"+value.data.ttalkinfo+"</p><a id= \"${jokeVo.jid}\" href=\"#\">回复</a>");
                    },
                    error: function() {
                    }
                });
        };
        </script>
       </div> 
      </div>
      </c:forEach>


      <script type="text/javascript">
          /**
           * 用于显示当前用户所有评论
           */
          function showCurrentComments(tid,id) {
              $.ajax({
                  type: "GET",
                  url: "${pageContext.request.contextPath}/Talk/searchOnecomment.do",
                  data: {"tid":tid},
                  dataType:"json",
                  async : true,
                  //contentType: 'application/json;charset=utf-8',
                  success: function(value){
                      console.log(value);
                      if(value.status==0){
                          //先清除之前的标签

                          var str = "";
                          var res = value.data.childrens;
                          console.log(res);
                          for(var i in res){
                              if (!isNaN(i)){
                                  console.log(i);
                                  var uid = res[i].uid;
                                  var uimg = res[i].uimg;
                                  var temp = new Date(res[i].tcreatetime);
                                  var tcreatetime = dateFtt("yyyy-MM-dd hh:mm:ss",temp);
                                  str += '<div id = "show2"  class="comment-show-con clearfix"><div class="comment-show-con-img pull-left"><img src='+uimg+' alt="用户头像"></div> <div class="comment-show-con-list pull-left clearfix"><div class="pl-text clearfix"> <a href="#" class="comment-size-name">'+res[i].uname+' </a> : <span class="my-pl-con">&nbsp;'+ res[i].ttalkinfo +'</span> </div> <div class="date-dz"> <span class="date-dz-left pull-left comment-time" id = "tid" talkid = '+res[i].tid+' uid = '+uid+'>'+tcreatetime+'</span><a href="javascript:void(0);" onclick="showCurrentComments('+res[i].tid+')">"查看当前回复"</a> <div class="date-dz-right pull-right comment-pl-block"><a href="javascript:;" class="removeBlock">删除</a> <a href="javascript:;" class="date-dz-pl pl-hf${jokeVo.jid} hf-con-block pull-left">回复</a> <span class="pull-left date-dz-line">|</span> <a href="javascript:;" class="date-dz-z pull-left"><i class="date-dz-z-click-red"></i>赞 (<i class="z-num">0</i>)</a> </div> </div><div class="hf-list-con"></div></div> </div></br>';
                                  console.log(str);
                              }
                          }
                          $("#s"+id).append(str);
                      }
                  },
                  error: function() {
                      alert("查询失败");
                  }
              });
          }


      </script>

      <!--删除评论块-->
      <script type="text/javascript">
          $('.commentAll').on('click','.removeBlock',function(){
              var oT = $(this).parents('.date-dz-right').parents('.date-dz').parents('.all-pl-con');
              if(oT.siblings('.all-pl-con').length >= 1){
                  oT.remove();
              }else {
                  $(this).parents('.date-dz-right').parents('.date-dz').parents('.all-pl-con').parents('.hf-list-con').css('display','none')
                  oT.remove();
              }
              $(this).parents('.date-dz-right').parents('.date-dz').parents('.comment-show-con-list').parents('.comment-show-con').remove();

              var tid = $(this).parent().parent().find("#tid").attr("talkid");
              console.log(tid);
              $.ajax({
                  type: "GET",
                  url: "${pageContext.request.contextPath}/Talk/delcomment.do",
                  data: {"tid":tid},
                  dataType:"json",
                  async : true,
                  success: function(value){
                     if(value.status == 0){
                         var nums = $("#comments${jokeVo.jid}").text();
                         var num= parseInt(nums);
                         var temp = value.data;
                         var res = num-temp;
                         console.log("删除了"+res);
                         alert(value.msg);
                     }else {
                         alert(value.msg);
                     }


                      },
                  error: function() {
                  }
              });
          })
      </script>

      <!-- 提示分页信息行 -->
      <div class="row">
       <!-- 分页文字信息 ：拿到控制器处理请求时封装在pageInfo里面的分页信息-->
       <div class="col-md-6">
        当前${res.pageNum}页,共${res.pages }页,总${res.total }条记录
       </div>
       <!-- 分页码 -->
       <div class="col-md-6">
        <nav aria-label="Page navigation">
         <ul class="pagination">
          <!--
                        1.pageContext.request.contextPath表示当前项目路径，采用的是绝对路径表达方式。一般为http:localhost:8080/项目名 。
                        2.首页，末页的逻辑：pn=1访问第一次，pn=res.pages访问最后一页
                      -->
          <li>
           <a href="${pageContext.request.contextPath}/joke/select.do?jcategory=${jcategory}&pageNum=1">首页</a>
          </li>
          <!-- 如果还有前页就访问当前页码-1的页面， -->
          <c:if test="${res.hasPreviousPage}">
           <li>
            <a href="${pageContext.request.contextPath}/joke/select.do?jcategory=${jcategory}&pageNum=${res.pageNum-1}" aria-label="Previous">
             <span aria-hidden="true">&laquo;</span>
            </a>
           </li>
          </c:if>
          <li>
           <!--遍历所有导航页码，如果遍历的页码页当前页码相等就高亮显示，如果相等就普通显示  -->
           <c:forEach items="${res.navigatepageNums }" var="page_Nums">
           <c:if test="${page_Nums==res.pageNum }">
          <li class="active"><a href="#">${page_Nums}</a></li>
          </c:if>
          <c:if test="${page_Nums!=res.pageNum }">
           <li ><a href="${pageContext.request.contextPath}/joke/select.do?jcategory=${jcategory}&pageNum=${page_Nums}">${page_Nums}</a></li>
          </c:if>
          </c:forEach>
          </li>
          <!-- 如果还有后页就访问当前页码+1的页面， -->
          <c:if test="${res.hasNextPage}">
           <li>
            <a href="${pageContext.request.contextPath}/joke/select.do?jcategory=${jcategory}&pageNum=${res.pageNum+1}" aria-label="Next">
             <span aria-hidden="true">&raquo;</span>
            </a>
           </li>
          </c:if>
          <li><a href="${pageContext.request.contextPath}/joke/select.do?jcategory=${jcategory}&pageNum=${res.pages}">末页</a></li>
         </ul>
        </nav>
       </div>
      </div>


     </div>

     <div class="commside"> 
      <!--右侧我要投稿公共部分--> 
      <div class="pb-iblock pb-fr pb-after-clear pb-main-side"> 
       <img alt="征文比赛 有奖征文" class="pb-block" src="/images/icon_tougaoyouqian.jpg" />
       <h6 class="pb-mt15 pb-clr1 pb-size-big">下期专题</h6> 
       <div class="pb-line2 pb-mt5"> 
       </div> 
       <a href="news_detail.jsp?/add" class="tle pb-mt5">年味为什么越来越淡了</a> 
       <div class="pb-line2 pb-mt5"> 
       </div> 
       <h6 class="pb-mt15"> <span class="pb-clr1 pb-size-normal">已投稿 <i class="tougao">3</i></span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a class="pb-clr1 pb-size-small pb-underline" href="javascript:Sys.showRuleDiv();">获奖规则</a> </h6> 
       <a href="news_detail.jsp?/add" class="but pb-clr1 pb-size-normal pb-mt15">有奖征文</a> 
      </div> 
      <!--右侧我要投稿公共部分--> 
      <div class="pb-main-side pb-iblock pb-after-clear pb-fr pb-mt40"> 
       <h6 class="pb-clr1 pb-size-big">征文排行</h6> 
       <div class="pb-line2 pb-mt5"> 
       </div> 
       <ul class="pb-mt10 previous-term pb-size-normal"> 
        <li> <span>.</span> <a href="news_detail.jsp?-8-55">有一种毕业，叫先走一步</a> 
         <div class="pb-line2"> 
         </div> </li> 
        <li> <span>.</span> <a href="news_detail.jsp?-4-27">用今生的修行 为你们的来生祈福</a> 
         <div class="pb-line2"> 
         </div> </li> 
        <li> <span>.</span> <a href="news_detail.jsp?-3-16">我的初恋</a> 
         <div class="pb-line2"> 
         </div> </li> 
        <li> <span>.</span> <a href="news_detail.jsp?-6-45">当你老了</a> 
         <div class="pb-line2"> 
         </div> </li> 
        <li> <span>.</span> <a href="news_detail.jsp?-7-50">我就在这里旅行，给你讲沿途的风景</a> 
         <div class="pb-line2"> 
         </div> </li> 
        <li> <span>.</span> <a href="news_detail.jsp?-6-43">有多少爱可以重来</a> 
         <div class="pb-line2"> 
         </div> </li> 
        <li> <span>.</span> <a href="news_detail.jsp?-4-28">我的“天空之城”</a> 
         <div class="pb-line2"> 
         </div> </li> 
       </ul> 
      </div> 
      <div style="clear:both;"></div> 
      <div class="sidewrap  pb-mt40"> 
       <h6 class="pb-clr1 pb-size-big">倾听世界</h6> 
       <div class="pb-line2 pb-mt5"> 
       </div> 
       <div style="height:480px;overflow:hidden;" class="con pr"> 
        <div style="left:150px;height:150px;top:15px;" class="single"> 
         <a title="清纯唯美写真合集" href="pic_detail.jsp?1"><img alt="清纯唯美写真合集" src="/images/qing_10001_7b053ee001_310.jpg" style="width:145px;" /></a>
        </div> 
        <div style="left:0px;height:150px;top:15px;" class="single"> 
         <a title="也许我就是一块老墨" href="pic_detail.jsp?3"><img alt="也许我就是一块老墨" src="/images/qing_10001_2278c48f96_310.jpg" style="width:145px;" /></a>
        </div> 
        <div style="left:150px;height:150px;top:170px;" class="single"> 
         <a title="证件照" href="pic_detail.jsp?4"><img alt="证件照" src="/images/qing_9999_6963913fb8_310.jpg" style="width:145px;" /></a>
        </div> 
        <div style="left:0px;height:150px;top:170px;" class="single"> 
         <a title="享笑网2015-5-30#325806#" href="pic_detail.jsp?6"><img alt="享笑网2015-5-30#325806#" src="/images/qing_10001_3f5af7636f_310.jpg" style="width:145px;" /></a>
        </div> 
        <div style="left:150px;height:150px;top:325px;" class="single"> 
         <a title="爱情就是一百多年的孤寂" href="pic_detail.jsp?7"><img alt="爱情就是一百多年的孤寂" src="/images/qing_10001_5502d62ca8_310.jpg" style="width:145px;" /></a>
        </div> 
        <div style="left:0px;height:150px;top:325px;" class="single"> 
         <a title="中国书法家【郝天明】书法新作(妙笔生辉" href="pic_detail.jsp?10"><img alt="中国书法家【郝天明】书法新作(妙笔生辉" src="/images/qing_10001_bcf83a76ac_310.jpg" style="width:145px;" /></a>
        </div> 
       </div> 
      </div> 
     </div> 
     <div style="clear:both;"></div> 
    </div>
    <div style="clear:both;"></div> 
    <!-- end content--> 
    <script>
/*vars.verifyHtml = '<img onclick="changeVerifyCodeImage();" id="yw1" src="/jokes/captcha/v/56a21f74ebf06" alt="" /><a href="javascript:void(0);" id="yw0_button" class="yw0_button" onclick="changeVerifyCodeImage();">看不清？点击这里</a>';
vars.jokesVerifyUrl = '/jokes/CheckVerifyCode';
vars.jokesCommentUrl = '/jokes/commentlist';*/

$(".c-l-jk-ipt").ssFocusBlur().parent().parent().find('.sub').click(function(){
    freshTable()

});
</script>
    <script type="text/x-jsmart-tmpl" id="replyTpl">
{foreach $comments as $k => $comment}
	<li name="{$comment.id}">
		<img src="{$comment.headimage}" alt="{$comment.nickname}"/><br/>
		{if $comment.nickname && $userNickname!=$comment.nickname}<a href="javascript:void(0);" class="hf">回复</a>{/if}
		<span class="nik">{if $comment.nickname}{$comment.nickname}{else}匿名用户{/if}:</span>
		<span>{$comment.content}</span>
	</li>
{/foreach}
</script>
   </div> 
   <!-- 公共尾部 --> 
   <div style="clear:both;"></div> 
   <div class="pb-footer"> 
    <div class="pb-footer-wp"> 
     <div class="pb-main pb-footer-cnt pb-size-small"> 
      <span class="pb-fl">&copy; 2012 - 2015 深圳市享笑网科技有限公司版权所有 粤 icp 备 13011067 号</span> 
      <ul class="pb-fr"> 
       <li><a target="_blank" href="http://www.whzcwl.com.cn">志诚网络</a></li> 
       <li><a href="http://wpa.qq.com/msgrd?v=1&amp;uin=2338601847&amp;site=www.sharesmile.cn&amp;menu=yes">版权声明</a></li> 
       <li><a href="http://wpa.qq.com/msgrd?v=1&amp;uin=2338601847&amp;site=www.sharesmile.cn&amp;menu=yes">客服中心</a></li> 
       <li><a href="http://wpa.qq.com/msgrd?v=1&amp;uin=2338601847&amp;site=www.sharesmile.cn&amp;menu=yes">联系我们</a></li> 
      </ul> 
     </div> 
    </div> 
   </div> 
   <!-- 公共尾部 --> 
   <div id="goTopButton" class="ssretotop"> 
    <div class="SG-sidecont"> 
     <a id="gotonext" href="javascript:;" style="visibility: visible;"></a> 
     <a title="点击我 坐飞机到顶部" style="visibility: visible;" href="javascript:void(0)" class="pb-icons" id="retotop"></a> 
     <a id="gotopre" href="javascript:;"></a> 
    </div> 
   </div> 
  </div> 
  <script type="text/x-jsmart-tmpl" id="tpl-pb-rule">
		<img src="/images/rule.gif" alt="获奖规则"/>
		<a href="javascript:top.window.location.href='/user#go=cash';" style="position: absolute; cursor:pointer;height: 24px; width: 72px; left: 730px; top: 494px; display:inline-block;background:#fff;opacity:0; filter:alpha(opacity=0);"></a>
	</script> 
  <script src="/js/15502332.js" type="text/javascript" language="javascript"></script>
  <noscript>
   <a href="http://www.51.la/?15502332" target="_blank"><img alt="我要啦免费统计" src="/images/15502332.asp" style="border:none" /></a>
  </noscript> 
  <script language="javascript" type="text/javascript">
	$(document).ready(function(){
		$(".pb-ucenter").bind('mouseenter', function(){
			$(this).find('ul').stop().slideDown('fast');
			Sys.clearFlicker('uMessageCenter');
		}).bind('mouseleave', function(){
			$(this).find('ul').stop().slideUp('fast');
		});
		
		$("#goTopButton").click(function(){
			Sys.scrollTo($('body'));
			Sys.commStat(33);
		});
		if( vars.browser != 'IE6'){
			var w_w = parseInt( $("body").width());
			var obj = $("#goTopButton");
			$(window).scroll(function(){
				if($(this).scrollTop() > 500){
					if( !isNaN(w_w) && w_w > 0){
						obj.css('left', (Math.ceil((w_w-1050)/2) + 1050 + 10) + "px" );
					}
					obj.fadeIn();
				}else{
					obj.fadeOut();
				}
			});
		}
		Sys.hide51();
	});
		
	</script> 
  <script src="/js/form.js" type="text/javascript"></script>
  <script type="text/javascript">
/*<![CDATA[*/


function changeVerifyCodeImage(){
	$.ajax({
		url: "\/jokes\/captcha\/refresh\/1",
		dataType: 'json',
		cache: false,
		success: function(data) {
			$('#yw1').attr('src', data['url']);
			$('body').data('captcha.hash', [data['hash1'], data['hash2']]);
		}
	});
	return false;	
}


/*]]>*/
</script> </body>
</html>